using IcsSEMCtrl.Util;
using System;
namespace IcsSEMCtrl.Global.Device
{
	public class AccessType
	{
		public const int _IN = 0;
		public const int _OUT = 1;
		public const int _IN_OUT = 2;
		private int _value;
		private static int _size;
		private static AccessType[] _array;
		public static string[] displayStrings;
		public static AccessType[] displayValues;
		public static AccessType IN;
		public static AccessType OUT;
		public static AccessType IN_OUT;
		public static AccessType IT_ENUM_MAX;
		static AccessType()
		{
			AccessType._size = 3;
			AccessType._array = new AccessType[AccessType._size];
			AccessType.displayStrings = new string[AccessType._size];
			AccessType.displayValues = new AccessType[AccessType._size];
			AccessType.IN = new AccessType(0);
			AccessType.OUT = new AccessType(1);
			AccessType.IN_OUT = new AccessType(2);
			AccessType.IT_ENUM_MAX = new AccessType(2147483647);
			AccessType.displayStrings[0] = "In";
			AccessType.displayStrings[1] = "Out";
			AccessType.displayStrings[2] = "In_Out";
			AccessType.displayValues[0] = AccessType.IN;
			AccessType.displayValues[1] = AccessType.OUT;
			AccessType.displayValues[2] = AccessType.IN_OUT;
		}
		public static string ValueToString(AccessType val)
		{
			string result;
			switch (val.Value())
			{
			case 0:
				result = AccessType.displayStrings[0];
				break;
			case 1:
				result = AccessType.displayStrings[1];
				break;
			case 2:
				result = AccessType.displayStrings[2];
				break;
			default:
				result = "";
				break;
			}
			return result;
		}
		public static AccessType StringToValue(string val)
		{
			AccessType result;
			if (Helper.IsNullOrEmpty(val))
			{
				result = AccessType.IT_ENUM_MAX;
			}
			else
			{
				for (int i = 0; i < AccessType.displayStrings.Length; i++)
				{
					if (val.Equals(AccessType.displayStrings[i]) || val.Equals(AccessType.displayStrings[i].ToUpper()))
					{
						result = AccessType.displayValues[i];
						return result;
					}
				}
				result = null;
			}
			return result;
		}
		public int Value()
		{
			return this._value;
		}
		public static AccessType From_Int(int value)
		{
			AccessType result;
			if (value >= 0 && value < AccessType._size)
			{
				result = AccessType._array[value];
			}
			else
			{
				result = AccessType.IT_ENUM_MAX;
			}
			return result;
		}
		protected AccessType(int value)
		{
			this._value = value;
			if (value >= 0 && value < AccessType._size)
			{
				AccessType._array[this._value] = this;
			}
		}
		public bool Equals(AccessType otherEnum)
		{
			return otherEnum.Value() == this._value;
		}
		public override string ToString()
		{
			return AccessType.displayStrings[this._value];
		}
	}
}
